using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class CanvasList : MonoBehaviour
{
	public static CanvasList instance;

	public RectTransform[] TF_CanvasList;

	public GameObject[] GO_PropsForTitle;

	public GameObject GO_Panel_Menu;

	public GameObject GO_Panel_Equip;

	public TextMeshProUGUI TXT_Level;

	public GameObject GO_JustTXT_HighestScore;

	public TextMeshProUGUI TXT_HighestScore;

	public TextMeshProUGUI TXT_Score;

	[Header("For Equip")]
	public GameObject GO_PlayVideoRewardAd;

	public GameObject GO_ShowVideoRewardGems;

	public Image IMG_BTN_SelectTheEquip;

	public TextMeshProUGUI TXT_EquipType;

	public TextMeshProUGUI TXT_EquipName;

	public TextMeshProUGUI TXT_EquipPower;

	public string ShowingKindOfEquipList;

	[Header("For Menu")]
	public Image[] IMG_BTN_SwtichList;

	public GameObject[] GO_MenuList;

	public TextMeshProUGUI[] TXT_StatList;

	private void Awake()
	{
		instance = this;
	}

	public void Panel_Menu_Toggle()
	{
		if (GO_Panel_Menu.activeSelf)
		{
			GO_Panel_Menu.SetActive(false);
			GO_PropsForTitle_Toggle(true);
			return;
		}
		GO_Panel_Menu.SetActive(true);
		GO_PropsForTitle_Toggle(false);
		StatsTextSetting();
		ShowSwitches();
	}

	public void Panel_Equip_Toggle()
	{
		if (GO_Panel_Equip.activeSelf)
		{
			GO_Panel_Equip.SetActive(false);
			GO_PropsForTitle_Toggle(true);
		}
		else
		{
			GO_Panel_Equip.SetActive(true);
			GO_PropsForTitle_Toggle(false);
		}
	}

	public void GO_PropsForTitle_Toggle(bool swt)
	{
		for (int i = 0; i < GO_PropsForTitle.Length; i++)
		{
			if (i == 9 && swt)
			{
				if (PlayerPrefs.GetInt("currentUnlockedCloakNumber") + 1 < VariousInfo.cloakInfo.Length && PlayerPrefs.GetInt("highestScore") >= VariousInfo.hiddenBossAppearHighscoreList[PlayerPrefs.GetInt("currentUnlockedCloakNumber")])
				{
					GO_PropsForTitle[i].SetActive(swt);
				}
			}
			else
			{
				GO_PropsForTitle[i].SetActive(swt);
			}
		}
	}

	public void ShowMenuItem(int num)
	{
		for (int i = 0; i < GO_MenuList.Length; i++)
		{
			GO_MenuList[i].SetActive((num == i) ? true : false);
		}
	}

	public void ShowLeaderboard()
	{
		GPGS.instance.ShowLeaderboard();
	}

	public void MusicSwtich_Toggle()
	{
		PlayerPrefs.SetString("musicSwitch", (!(PlayerPrefs.GetString("musicSwitch") == "off")) ? "off" : "on");
		Audio.instance.MusicSwitch(PlayerPrefs.GetString("musicSwitch"));
		ShowSwitches();
	}

	public void BloodColorSwtich_Toggle()
	{
		PlayerPrefs.SetInt("forAdult", (PlayerPrefs.GetInt("forAdult") == 0) ? 1 : 0);
		ShowSwitches();
	}

	public void ShowSwitches()
	{
		IMG_BTN_SwtichList[0].sprite = Sprites.instance.switchONOFFList[(PlayerPrefs.GetString("musicSwitch") == "off") ? 1u : 0u];
		IMG_BTN_SwtichList[1].sprite = Sprites.instance.switchONOFFList[(PlayerPrefs.GetInt("forAdult") == 0) ? 1u : 0u];
	}

	public void StatsTextSetting()
	{
		TXT_StatList[0].text = PlayerPrefs.GetInt("highestScore") + "p";
		TXT_StatList[1].text = PlayerPrefs.GetInt("enemiesKilled").ToString();
		TXT_StatList[2].text = PlayerPrefs.GetInt("deaths").ToString();
		TXT_StatList[3].text = PlayerPrefs.GetInt("playerGem").ToString();
	}
}
